﻿<html >
<head>
    <title>Webtop application</title>
    <script type="text/javascript" src="../dhtiny.js"></script>
    <script type="text/javascript" src="../util/dragmgr.js"></script>
    <script type="text/javascript" src="../util/animgr.js"></script>
    <script type="text/javascript" src="../ctrl/tbform.js"></script>
    <script type="text/javascript" src="../ctrl/treeview.js"></script>
    
    <script type="text/javascript" src="webtop/Icon.js"></script>
    <script type="text/javascript" src="webtop/Taskbar.js"></script>
 
    <link rel="stylesheet" type="text/css" href="webtop/css/main.css" />
</head>
<body> <!-- *background="webtop/images/backgroundcorner.gif"-->
<script type="text/javascript">
$dh.Main = function() {
    var taskbar = $dh.$new("div",{opac:100});    
    $dh.construct(taskbar, Taskbar,[27]);
    $dh.addCh(document.body, taskbar);/**/

    $dh.construct(document.body,GridManager,[]);
    $dh.construct(document.body,DHFormManager,[]);
    
    document.body.moveGridTo(10,30);
    for (var k = 0 ; k < 16 ; k ++ ) {
        var icon = $dh.$new(GridIcon, [document.body, (k%2==0)? "Ghost drag": "Normal drag",k%5])
        icon.ondblclick = function() {
            if (!$dh.isNone(this.targetForm)) {
                this.targetForm.show();
                return;
            }
       
            var form = $dh.$new(DHTbForm,[document.body,{statusTxt: "Status text: --", captionTxt: "DHTbForm Class Demo", themeIndex: 3}]);
            this.targetForm = form;
            document.body.currentDHForm = this.targetForm;
            this.targetForm.style.zIndex = 999;
        
            form.setBounds(200,200,320,270);
            form.show(true);
            DHDRAG.setDrag(form.captionbar, form, [{mode:"MOVE", ghostDrag: (this.labelText.indexOf("Ghost")>=0), hideTarget: false}/*, {mode:"RESIZE"}*/]);
            
            $dh.addEv(form, "mousedown", function(ev) {
                document.body.currentDHForm.style.zIndex = 0;
                document.body.currentDHForm = form;
                form.style.zIndex = 999;
            });
            
            
            form.setMaxSize(form.maxSize.width, form.maxSize.height - $dh.size(window.Taskbar).height-2);
                    
            // TreeView Demo
            var tree = $dh.$new(DHTreeView,[18]);
            $dh.addCh(form.body, tree);
            tree.style.border ="solid 3px green";
            tree.style.backgroundColor = "#fccca3";
            tree.style.height = "100%";
            
            tree.setCacheFlag(true); // ***NEW*** : Set caching just once
            tree.onExpandingNode = function(node) {
                if (node.dataCached != true) {
                    node.parentTree.expandNode(node, window.data1);
                }
            }
            tree.expandNode(null,data1);
        }
    }     
    window.data1 = [["Folder-A",0],["File-B",1],["File-C",1],["File 1",1],["Folder-AB",0]];
}

</script>
</body>
</html>